#ifndef CHOICEFORM_HPP
#define CHOICEFORM_HPP

#include <QWidget>
#include <vector>
#include <stack>
#include <ExamInterface.hpp>
#include <QAbstractButton>
#include <Question.hpp>

namespace Ui {
class ChoiceForm;
}
class QLabel;

struct ChoiceQuestion{
    std::vector<QStringRef> choices;
    QString *content;
    unsigned id;
    unsigned answer;
    bool multichoice;
};

struct VisibleItem{
    QLabel *label;
    QStringRef content;
    bool answer;
};

class QRadioButton;
class QCheckBox;
class QButtonGroup;
class QSqlDatabase;
struct ExamConfig;

class ChoiceForm : public QWidget,public ExamInterface
{
    Q_OBJECT

public:
    explicit ChoiceForm(RandomQuestion *rdq,QWidget *parent = 0);
    ~ChoiceForm();
    void loadquestion(const ChoiceQuestion *q);
    bool checkCorrection(QString *msg);
    bool nextQuestion(QString *msg);
    void updateConfig(const ExamConfig *);
    void clearText();
private:
    Ui::ChoiceForm *ui;
    std::vector<VisibleItem> prevWidgets;
    std::stack<QLabel*> backups;
    RandomQuestion *randomq;
    const QFont *itemfont;
    bool status;
};

#endif // CHOICEFORM_HPP
